type twoSum<N extends number[], T extends number, Set> = N['length'] extends 0
? false
: diff<N[0], T> extends Set 
? [diff<N[0], T>, N[0]]
: twoSum<removeFirst<N>, T, Set | N[0] >

type removeFirst<N extends number[]> = N extends [unknown, ...infer Other] ? Other : []

type buildArr<N extends number, res extends unknown[] = []> = res['length'] extends N ? res : buildArr<N, [unknown, ...res]>

type diff<N extends number, T extends number> = buildArr<T> extends [...buildArr<N>, ...infer other] ? other['length'] : never

type twoSumRes = twoSum<[1,2,3,4,5], 9, ''>